<template>
	<view class="mine-container" :style="{height: `${windowHeight}px`}">
		<!--顶部个人信息栏-->
		<div class="header">
			<view class="user-img">
				<image class="user-avatar" src="@/static/images/user-header.png"></image>
			</view>
			<view class="user-name">
				{{userinfo.userName || "未知用户"}}
			</view>
			<view class="user-role">
				管理员
			</view>
			<view class="user-info-cell">
					<image class="name" src="@/static/images/telephone.svg"></image>
				<view class="value">
					{{userinfo.phone || "***********"}}
				</view>
				
			</view>
			<view class="user-info-cell">
				<image class="name" src="@/static/images/email.svg"></image>
				<view class="value">
					{{userinfo.email || "**********@qq.com"}} 
				</view>
			</view>
		</div>

		<view class="lougout" @click="handleLogout">
			退出
		</view>
		
		<view class="setting"  @click="handleSetting">
			设置
		</view>
		<movable></movable>
	</view>
</template>

<script>
	import storage from '@/utils/storage'
	export default {
		data() {
			return {
				name: this.$store.state.user.name,
				version: getApp().globalData.config.appInfo.version
			}
		},
		computed: {
			userinfo() {
				return this.$store.state.user.userinfo || {}
			},
			windowHeight() {
				return uni.getSystemInfoSync().windowHeight
			}
		},
		methods: {
			// this.$tab.navigateTo('/pages/mine/info/index')
			handleToLogin() {
				this.$tab.reLaunch('/pages/login')
			},
			handleLogout() {
				this.$modal.confirm('确定注销并退出系统吗？').then(() => {
					this.$store.dispatch('LogOut').then(() => {
						this.$tab.reLaunch('/pages/index')
					})
				})
			},
			handleSetting(){
				this.$tab.navigateTo('/pages/setting/setting');
			}
		}
	}
</script>

<style lang="scss" scoped>
	.mine-container {
		width: 100%;
		height: 100%;
		background-color: white;
	}

	.header {
		width: 100%;
		height: 600rpx;
		flex-shrink: 0;
		background-color: #3461FD;
		padding-top: 124rpx;
		border-bottom-left-radius: 200rpx;
		border-bottom-right-radius: 200rpx;

	}

	.user-img {
		width: 264rpx;
		height: 264rpx;
		flex-shrink: 0;
		border-radius: 528rpx;
		border: 2px solid #FFF;
		background: url(<path-to-image>), lightgray 50% / cover no-repeat;
		margin: 0 auto;
		overflow: hidden;

	}

	/deep/ .user-avatar {
		width: 264rpx;
		height: 264rpx;
		background-size: contain;
	}

	.user-name {
		color: #FFF;
		font-size: 44rpx;
		font-family: Open Sans;
		font-style: normal;
		font-weight: 700;
		line-height: normal;
		margin: 8px auto;
		text-align: center;
	}

	.user-role {
		width: 206rpx;
		height: 52rpx;
		flex-shrink: 0;
		border-radius: 50rpx;
		background: rgba(255, 255, 255, 0.56);
		color: #3461FD;
		font-size: 30rpx;
		font-family: Open Sans;
		font-style: normal;
		font-weight: 400;
		line-height: 52rpx;
		text-align: center;
		margin: 0 auto;
		margin-bottom: 40rpx;
	}

	.lougout {
		padding: 8rpx 32rpx;
		border-radius: 24rpx;
		background: #3461FD;
		color: #FFF;
		font-size: 24rpx;
		font-family: PingFang SC;
		font-style: normal;
		font-weight: 800;
		line-height: 64rpx;
		letter-spacing: 0.06px;
		text-align: center;
		margin: 0 20rpx;
		margin-top: 178rpx;
	}
	
	.user-info-cell{
		display: flex;
		padding-left:calc(50% - 120rpx) ;
		line-height: 40rpx;
		align-items: center;
		.name{
			width: 30rpx;
			height: 30rpx;
			margin-right: 16rpx;
		}
		.value{
			color: #FFF;
			font-size: 24rpx;
			font-family: Open Sans;
			font-style: normal;
			font-weight: 400;
			line-height: inherit;
		}
	}
	
	.setting{
		position: fixed;
		right: 30rpx;
		top: 60rpx;
		width: 100rpx;
		height: 100rpx;
		text-align: center;
		line-height: 100rpx;
		font-size: 34rpx;
		font-weight: 600;
	}
</style>